<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    请输入:<input type="text" @keyup.enter="submit" v-model.number="value">
    空格加一 <input type="text" @keyup.space="add">
    以确认键结束
    结果<span v-text="value"></span>
</div>

</body>
<script src="./node_modules/vue/dist/vue.js"></script>
<script type="text/javascript">
    let vm = new Vue({
        el: "#app",
        data: {
            value: ""
        },
        methods: {
            submit: function () {
                console.log(this.value);
            },
            add: function () {
                this.value++;
            }
        }
    });
</script>
</html>